home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 26 (Anniversary Edition)
/
Volume 26 [Anniversary Edition] - JOGO DISK .iso
/
Fight
/
starwars.swf
/
scripts
/
frame_145
/
PlaceObject2_150_232
/
CLIPACTIONRECORD onClipEvent(load).as
< prev
Wrap
Text File
|
2006-09-05
|
4KB
|
156 lines
onClipEvent(load){
function stateCheck()
{
if(attackFlag == 0)
{
if(beforeState != 2 and nowState == 2)
{
this.gotoAndStop("standing");
this._xscale = math.abs(this._xscale);
this.standUp.goToAndStop("walking");
}
else if(beforeState != 4 and nowState == 4)
{
this.gotoAndStop("standing");
this._xscale = - math.abs(this._xscale);
this.standUp.goToAndStop("walkimg");
}
else if(beforeState != 3 and nowState == 3)
{
this.gotoAndStop("sitdown");
this.sitDown.goToAndStop("down");
}
}
}
function keyInMove()
{
if(attackFlag == 0)
{
if(key.isDown(key.RIGHT) and this._x < 500)
{
nowState = 2;
stateCheck();
beforeState = 2;
this._x += speed;
this.standUp.play();
}
else if(key.isDown(key.LEFT) and 0 < this._x)
{
nowState = 4;
stateCheck();
beforeState = 4;
this._x -= speed;
this.standUp.play();
}
else if(key.isDown(key.DOWN))
{
nowState = 3;
stateCheck();
beforeState = 3;
}
}
}
function AttackCheck()
{
if(attackFlag == 0)
{
if(attackNumber == 1)
{
if(nowState == 4 or nowState == 2)
{
attackFlag = 1;
attackNumber = 0;
this.standUp.goToAndPlay("fist");
}
else if(nowState == 3)
{
attackFlag = 1;
attackNumber = 0;
this.sitDown.gotoAndPlay("downfist");
}
}
else if(attackNumber == 2)
{
if(nowState == 4 or nowState == 2)
{
attackFlag = 1;
attackNumber = 0;
this.standUp.goToAndPlay("kick");
}
else if(nowState == 3)
{
attackFlag = 1;
attackNumber = 0;
this.sitDown.gotoAndPlay("downkick");
}
}
}
}
function KeyInAttack()
{
if(attackFlag == 0)
{
if(Key.isDown(90))
{
attackNumber = 1;
AttackCheck();
this.mySound("attackSound1");
}
if(Key.isDown(88))
{
attackNumber = 2;
AttackCheck();
this.mySound("attackSound2");
}
}
}
function chMainStroke(numK)
{
if(0 < energy)
{
attackFlag = 1;
energy -= 10;
_root.energyLine.energySub(10);
if(numK == 1)
{
if(0 < energy)
{
this.mySound("Chmainhit");
this.standUp.gotoAndPlay("hit");
}
else
{
this.mySound("chManDie");
this.standUp.gotoAndPlay("die");
}
}
else if(numK == 2)
{
if(0 < energy)
{
this.mySound("Chmainhit");
this.sitDown.gotoAndPlay("downhit");
}
else
{
this.mySound("chManDie");
this.sitDown.gotoAndPlay("downdie");
}
}
}
}
function mySound(soundName)
{
GSound.stop();
GSound.attachSound(soundName);
GSound.start();
}
speed = 4;
beforeState = 0;
nowState = 0;
attackFlag = 0;
attackNumber = 0;
energy = 200;
GSound = new Sound(this);
}